package com.joysuch.wwyt.risk.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joysuch.wwyt.core.support.Context;
import com.joysuch.wwyt.risk.entity.RiskDynamicRecord;
import com.joysuch.wwyt.risk.mapper.RiskDynamicRecordMapper;
import com.joysuch.wwyt.risk.service.RiskDynamicRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zqw
 * @since 2022-04-15
 */
@Service
public class RiskDynamicRecordServiceImpl extends ServiceImpl<RiskDynamicRecordMapper, RiskDynamicRecord> implements RiskDynamicRecordService {

    @Autowired
    private RiskDynamicRecordMapper riskDynamicRecordMapper;

    @Override
    public List<RiskDynamicRecord> getRecordsByTypeAndTaskCodeAndStatus(Integer riskType, String taskCode, Integer status) {
        return riskDynamicRecordMapper.getRecordsByTypeAndTaskCode(riskType, taskCode, status, Context.getCompanyCode(), Context.getCurrentTenantId());
    }

    @Override
    public List<RiskDynamicRecord> getLastRecordsByTaskCodeAndType(String taskCode, int riskType) {
        return riskDynamicRecordMapper.getLastRecordByTaskCodeAndType(taskCode, riskType, Context.getCompanyCode(), Context.getCurrentTenantId());
    }

    @Override
    public List<RiskDynamicRecord> getAllByTaskCodeAndRiskType(String code, Integer riskType) {
        return riskDynamicRecordMapper.getAllByTaskCodeAndRiskType(code, riskType, Context.getCompanyCode(), Context.getCurrentTenantId());
    }

    @Override
    public List<RiskDynamicRecord> findAllByTaskCodesAndRiskType(List<String> taskCodes, int riskType) {
        return riskDynamicRecordMapper.findAllByTaskCodesAndRiskType(taskCodes, riskType, Context.getCompanyCode(), Context.getCurrentTenantId());
    }

    @Override
    public List<RiskDynamicRecord> findAllByRiskType(int riskType) {
        return riskDynamicRecordMapper.findAllByRiskType(riskType, Context.getCompanyCode(), Context.getCurrentTenantId());
    }

    @Override
    public List<RiskDynamicRecord> findAllByTaskCodeRiskTypeAndStatus(String taskCode, int riskType, int status,String orgCode,Long tenentId) {
        return riskDynamicRecordMapper.findAllByTaskCodeRiskTypeAndStatus( taskCode,  riskType,  status, orgCode, tenentId);
    }

}
